package cn.usian.controller;

import cn.usian.mapper.EmpMapper;
import cn.usian.pojo.Emp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

@Controller
public class EmpController {
    //依赖注入
    @Autowired
    private EmpMapper empMapper;

    //跳转路径
    @GetMapping("/emp")
    public String findAll(Model model) {
        List<Emp> all = empMapper.findAll();
        model.addAttribute("list", all);
        return "index";
    }

}
